<?php
include_once('common/header.php');
if($AppUI->id <= 0 || (isset($_SESSION['seo']) && (($_SESSION['seo']&1<<2) == 0))) {
	Vfriend_Function::redirect(HOST_BACKEND);
}
$intSeoId		= $objRequest->getParam('pseoid', 0);
$strRefer		= $objRequest->getParam('prefer', HOST_BACKEND . 'seo/index');
$strName		= $objRequest->getParam('pname', '');
$strTitle		= $objRequest->getParam('ptitle', '');
$strKeywords	= $objRequest->getParam('pkeywords', '');
$strDescription	= $objRequest->getParam('pdescription', '');
$intError		= 0;
if($strName == '') $intError = 7;
elseif($strName != '' && strlen($strName) < 5) $intError = 8;
elseif($strTitle == '') $intError = 9;
elseif($strKeywords == '') $intError = 10;
elseif($strDescription == '') $intError = 11;
if($intError == 0) {
	if(isset($_SESSION['post'])) unset($_SESSION['post']);
	if(isset($_SESSION['serr'])) unset($_SESSION['serr']);
	$objSeo = new Seo();
	$intError	= $objSeo->update($AppUI->id, $intSeoId, $strName, $strTitle, $strKeywords, $strDescription);
	if($intError == 0) {
		Vfriend_Function::setMsg($arrMessage[2]);
		Vfriend_Function::redirect($strRefer);
	}
}
if($intError > 0) {
	$_SESSION['post']	= $objRequest->getParams();
	$_SESSION['serr']	= $arrError[$intError];
	Vfriend_Function::redirect(HOST_BACKEND . 'seo/edit?seoid='.$intSeoId);
}
?>